package com.wolainfo.simulator.model.tfi;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

@Entity
@IdClass(com.wolainfo.simulator.model.tfi.TransactionPreferredSharelot.TransactionPreferredSharelotId.class)
public class TransactionPreferredSharelot{
    @Id
    private Integer transactionId;
    @Id
    private Integer sharelotId;
    @Column(name = "SEQUENCEID")
    private Integer sequence;

    public Integer getTransactionId(){
        return transactionId;
    }

    public void setTransactionId(Integer transactionId){
        this.transactionId = transactionId;
    }

    public Integer getSharelotId(){
        return sharelotId;
    }

    public void setSharelotId(Integer sharelotId){
        this.sharelotId = sharelotId;
    }

    public Integer getSequence(){
        return sequence;
    }

    public void setSequence(Integer sequence){
        this.sequence = sequence;
    }

    public static class TransactionPreferredSharelotId{
        public TransactionPreferredSharelotId(){}
        private Integer transactionId;
        private Integer sharelotId;

        public Integer getFundTransactionId(){
            return transactionId;
        }

        public void setFundTransactionId(Integer fundTransactionId){
            this.transactionId = fundTransactionId;
        }

        public Integer getAccountId(){
            return sharelotId;
        }

        public void setAccountId(Integer accountId){
            this.sharelotId = accountId;
        }

        @Override
        public boolean equals(Object obj){
            if(!(obj instanceof TransactionPreferredSharelotId))
                return false;
            TransactionPreferredSharelotId id = (TransactionPreferredSharelotId)obj;
            if(transactionId.compareTo(id.transactionId) != 0)
                return false;
            if(sharelotId.compareTo(id.sharelotId) != 0)
                return false;
            return true;
        }

        @Override
        public int hashCode(){
            return transactionId.hashCode() * sharelotId.hashCode();
        }
    }
}
